Skip to content

This pull request introduces several improvements and cleanups to the prompt handling API, particularly around LinkedIn profile analysis and prompt record management. #85

Merged
goldlabelapps merged 5 commits intomasterfrom
staging
Apr 13, 2026

Conversation

@goldlabelapps
Copy link
Copy Markdown
Owner

The most significant changes include enhancing the LinkedIn prompt endpoint to use Gemini models for analysis, improving prompt caching and database logic, and removing the deprecated prospect_id field and related logic from the codebase and database schema.

LinkedIn Prompt Enhancements:

  • The /prompt/linkedin endpoint now generates a Gemini model analysis if no cached result is found, using multiple model fallbacks and returning a detailed response with metadata, model used, and duration. The prompt is also dynamically constructed if not provided. [1] [2] [3] [4]

Database and Schema Updates:

  • The prompt table schema has been updated to remove the prospect_id field and its foreign key, as well as the deprecated data column placement.
  • The unused llm table drop statement has been removed from the SQL migration scripts.

Prompt Record Management Cleanups:

  • All logic and API parameters related to filtering or storing by prospect_id have been removed from the /prompt endpoints, simplifying both the API and the database interactions. [1] [2] [3] [4]

These changes modernize the prompt analysis workflow, streamline the database schema, and remove unused or deprecated functionality for improved maintainability.

Accept both linkedin_url and legacy linkedinUrl in request payloads and normalize to linkedin_url. Update error message to reference linkedin_url. Query logic now checks for a search_vector column and, if present, uses full-text search (plainto_tsquery) plus COALESCE(data->>'linkedin_url', data->>'linkedinUrl') to match stored data; otherwise fall back to previous prompt ILIKE / data match. Responses now return linkedin_url in the data payload for consistency and backwards-compatible lookup.
Remove the prospect_id foreign key from the prompt CREATE TABLE SQL and adjust column order (model moved before data). Also delete drop_llm_table.sql which contained DROP TABLE IF EXISTS llm. Note: this updates the table creation script only—apply a DB migration if you need to remove the existing column or preserve data.
Include the original prompt in cached LinkedIn prompt lookups by adding the prompt column to the SELECT queries and updating the row index mappings. Also add a prompt key (None when not cached) to the response payload so callers receive the associated prompt along with completion, time, model, and record data.
Drop prospect_id filtering and storage from prompt APIs and DB interactions. get_prompt_records no longer accepts or handles prospect_id and always returns paginated prompt records (SELECT no longer includes prospect_id). llm_post no longer reads prospect_id from payload and INSERT into prompt omits the prospect_id column. Error handling and pagination metadata preserved.
When a LinkedIn URL is not found in cache, call Google Gemini to generate a profile analysis and store the result. Adds GEMINI_API_KEY env check, a default prompt if none supplied, and a model fallback loop that tries several Gemini models until one returns text. Inserts the completion, model, duration and metadata into the prompt table (with search_vector when available), closes DB cursors/connections earlier, and returns the generated completion and record id in the response. Improves error handling and updates response meta messages accordingly.
@goldlabelapps goldlabelapps merged commit c9be028 into master Apr 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant